package com.efast.dmom.mgmt.service.les.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.efast.cafe.framework.exception.ServiceException;
import com.efast.cafe.framework.jdbc.JdbcDao;
import com.efast.cafe.framework.util.SpringWebUtils;
import com.efast.dmom.mgmt.dao.les.TrBasPartStorageDao;
import com.efast.dmom.mgmt.dao.les.TwActAllocLotdDao;
import com.efast.dmom.mgmt.dao.les.TwBasPartBatchDao;
import com.efast.dmom.mgmt.dao.les.TwBasPartBatchHeaderDao;
import com.efast.dmom.mgmt.dao.les.TwDocOrderDetailsDao;
import com.efast.dmom.mgmt.dao.les.TwDocOrderHeaderDao;
import com.efast.dmom.mgmt.dao.les.TwInvSkuLoctlDao;
import com.efast.dmom.mgmt.dao.les.TwOutbTaskDetailDao;
import com.efast.dmom.mgmt.dao.les.TwOutbTaskHeaderDao;
import com.efast.dmom.mgmt.entity.les.TrBasPartStorage;
import com.efast.dmom.mgmt.entity.les.TwActAllocLotd;
import com.efast.dmom.mgmt.entity.les.TwBasPartBatch;
import com.efast.dmom.mgmt.entity.les.TwBasPartBatchHeader;
import com.efast.dmom.mgmt.entity.les.TwDocOrderDetails;
import com.efast.dmom.mgmt.entity.les.TwDocOrderHeader;
import com.efast.dmom.mgmt.entity.les.TwInvSkuLoctl;
import com.efast.dmom.mgmt.entity.les.TwOutbTaskDetail;
import com.efast.dmom.mgmt.entity.les.TwOutbTaskHeader;
import com.efast.dmom.mgmt.service.les.TwDocOrderDetailsService;
import com.efast.dmom.mgmt.utils.Assist;
@Transactional
@Service
public class TwDocOrderDetailsServiceImpl implements TwDocOrderDetailsService {

	@Autowired
	private TwDocOrderDetailsDao twDocOrderDetailsDao;

	@Autowired
	private TwDocOrderHeaderDao twDocOrderHeaderDao;

	@Autowired
	private TwBasPartBatchHeaderDao twBasPartBatchHeaderDao;

	@Autowired
	private TwBasPartBatchDao twBasPartBatchDao;

	@Qualifier("jdbcDao")
	@Autowired
	private JdbcDao jdbcDao;

	/**
	 * 拣货任务表 TW_OUTB_TASK_HEADER
	 */
	@Autowired
	private TwOutbTaskHeaderDao twOutbTaskHeaderDao;

	/**
	 * 零件仓储关系以及动态库位入库选择规则 tr_bas_part_storage
	 */
	@Autowired
	private TrBasPartStorageDao trBasPartStorageDao;

	/**
	 * 库存表TW_INV_SKU_LOC_T_L
	 */
	@Autowired
	private TwInvSkuLoctlDao twInvSkuLoctlDao;

	/**
	 * 拣货任务表 TW_OUTB_TASK_DETAIL
	 */
	@Autowired
	private TwOutbTaskDetailDao twOutbTaskDetailDao;

	/**
	 * 分配表 TW_ACT_ALLOC_LOT_D
	 */
	@Autowired
	private TwActAllocLotdDao twActAllocLotdDao;

	/**
	 * 出库订单details的新增 后台需哟啊生成：行号/状态/
	 */
	@Override
	public int insertNonEmptyTwDocOrderDetails(TwDocOrderDetails value) {
		TwDocOrderHeader twDocOrderHeader = twDocOrderHeaderDao
				.selectTwDocOrderHeaderById(value.getTwDocOrderHeaderId());
		if (!twDocOrderHeader.getSoSheetStatus().equals("0")) {
			throw new ServiceException("Header状态为0时才能新增detail");
		}
		Assist assist = new Assist(
				Assist.andEq("tw_doc_order_details.tw_doc_order_header_id", value.getTwDocOrderHeaderId()));
		long count = twDocOrderDetailsDao.getTwDocOrderDetailsRowCount(assist);
		// 订单行状态（新单0、部分分配1、分配完成2、部分拣货3、拣货完成4、订单取消9、关闭10、分配失败11）
		value.setLineStatus("0");
		value.setSoLineno((int) count + 1);
		// 要求的数据字段copy到实际的数据字段中去
		// value.setSoReceivedQty(value.getSoReqQty()); // 实际发货数量
		// value.setSendPackageNo(value.getSoPackageNo()); // 实际发货包装编号
		// value.setSendPackageNum(value.getSoPackageNum()); // 实际发货箱数
		// value.setLineReceivedTime(value.getSoSendTime()); // 实际发货时间
		// value.setSendPackageQty(value.getSoPackageQty()); // 实际发货包装容量
		value.setSoReceivedQty(0); // 实际发货数量
		value.setSendPackageNum(0); // 实际发货箱数
		value.setSendPackageQty(0); // 实际发货包装容量

		List<TwBasPartBatchHeader> listTwBasPartBatchHeader = twBasPartBatchHeaderDao.selectTwBasPartBatchHeader(
				new Assist(Assist.andEq("tw_bas_part_batch_header.part_no_version", value.getPartNoVersion()),
						Assist.andEq("tw_bas_part_batch_header.suppl_no", value.getSupplNo())));
		if (listTwBasPartBatchHeader.size() == 0) {
			throw new ServiceException(value.getPartNoVersion() + "没有配置零件批次属性组头");
		}

		List<TwBasPartBatch> listTwBasPartBatch = twBasPartBatchDao
				.selectTwBasPartBatch(new Assist(Assist.andEq("tw_bas_part_batch.tw_bas_part_batch_header_id",
						listTwBasPartBatchHeader.get(0).getTwBasPartBatchHeaderId())));
		String a = ""; // 是否质检
		for (TwBasPartBatch twBasPartBatch : listTwBasPartBatch) {
			if (twBasPartBatch.getBatchOrder().equals("LOTATT05")) {
				a = twBasPartBatch.getIsUsedforLot();
			}
		}
		value.setLotatt02(listTwBasPartBatchHeader.get(0).getPlantNo());
		value.setLotatt03(listTwBasPartBatchHeader.get(0).getWorkshopNo());
		value.setLotatt04(listTwBasPartBatchHeader.get(0).getSupplNo());
		value.setLotatt05(a);

		value.setCreateTime(new Date());
		value.setCreateUser(SpringWebUtils.getRequestUser());
		value.setCompanyCode(SpringWebUtils.getRequestCompany());
		return twDocOrderDetailsDao.insertNonEmptyTwDocOrderDetails(value);
	}

	/**
	 * 按行分配 可操作状态：部分分配1，分配完成2 操作后状态：1，2
	 * 
	 * @param twDocOrderDetails
	 */
	@Override
	public void distributionByBill(TwDocOrderDetails enti,String pickAllocNo) {
		TwDocOrderDetails twDocOrderDetails = twDocOrderDetailsDao
				.selectTwDocOrderDetailsById(enti.getTwDocOrderDetailsId());
		if (!(twDocOrderDetails.getLineStatus().equals("0") || twDocOrderDetails.getLineStatus().equals("1")
				|| twDocOrderDetails.getLineStatus().equals("11"))) {
			throw new ServiceException("detail 新单0 部分分配1,分配失败11 时,才能新增detail");
		}
		// 【4】：生成 拣货任务表 TW_OUTB_TASK_HEADER
		TwOutbTaskHeader twOutbTaskHeader = new TwOutbTaskHeader();
		// 拣货状态0新任务1拣货完成2部分拣货3
		twOutbTaskHeader.setInboundStatus("0");
		twOutbTaskHeader.setSoSheetNo(twDocOrderDetails.getSoSheetNo());
		// 订单行状态（新单0、部分分配1、分配完成2、部分拣货3、拣货完成4、订单取消9、关闭10、分配失败11）
		enti.setLineStatus("2");
		twDocOrderDetailsDao.updateNonEmptyTwDocOrderDetailsById(enti);
		// 拣货任务清单打印状态（0打印1已打印)
		twOutbTaskHeader.setPrintStatus("0");
		twOutbTaskHeader.setPickAllocNo(pickAllocNo);
		twOutbTaskHeader.setTaskCreateman(SpringWebUtils.getRequestUser());
		twOutbTaskHeader.setTaskCreatetime(new Date());
		twOutbTaskHeader.setMarkStatus(1);
		twOutbTaskHeader.setCompanyCode(SpringWebUtils.getRequestCompany());
		twOutbTaskHeader.setCreateUser(SpringWebUtils.getRequestUser());
		twOutbTaskHeader.setCreateTime(new Date());
		twOutbTaskHeaderDao.insertNonEmptyTwOutbTaskHeader(twOutbTaskHeader);
		// 根据零件号 去 零件仓库关系（tr_bas_part_storage）找一个库位
		List<TrBasPartStorage> listTrBasPartStorage = trBasPartStorageDao.selectTrBasPartStorage(
				new Assist(Assist.andEq("tr_bas_part_storage.part_no_version", twDocOrderDetails.getPartNoVersion())));
		// 分配表 TW_ACT_ALLOC_LOT_D
		TwActAllocLotd twActAllocLotd = new TwActAllocLotd();
		// 拣货任务表 TW_OUTB_TASK_DETAIL
		TwOutbTaskDetail twOutbTaskDetail = new TwOutbTaskDetail();

		// 【6】：库存表 TW_INV_SKU_LOC_T_L
		// 分配完成后的库存变化 ： 可用数量-AVAILABLE_QTY==0 , 库存数量-CUR_QTY==1 , 待出库数量-R_OUB_QTY==1
		// 分配数量-R_ALLOC_QTY == 1 , 出库订单分配数量-SO_R_ALLOC_QTY == 1 , 拣货数量-R_PICK_QTY == 0
		// 出库订单拣货数量-SO_R_PICK_QTY == 0
		List<TwInvSkuLoctl> listTwInvSkuLoctl = twInvSkuLoctlDao.selectTwInvSkuLoctl(
				new Assist(Assist.andEq("tw_inv_sku_loc_t_l.tm_bas_storage_id", listTrBasPartStorage.get(0).getLocId()),
						Assist.andEq("tw_inv_sku_loc_t_l.part_no_version", twDocOrderDetails.getPartNoVersion())));
		if (listTwInvSkuLoctl.size() == 0) {
			// 分配的库位在库存表中没有记录
			throw new ServiceException("库存表中没有零件=" + twDocOrderDetails.getPartNoVersion() + "并且库位id="
					+ listTrBasPartStorage.get(0).getLocId());
		}
		if (listTwInvSkuLoctl.get(0).getAvailableQty()<=0||listTwInvSkuLoctl.get(0).getCurQty()<=0) {
			throw new ServiceException("可用数量或库存数量不足");
		}
		if (listTwInvSkuLoctl.get(0).getAvailableQty()<listTwInvSkuLoctl.get(0).getCurQty()) {
			throw new ServiceException("库存数量不可小于可用数量");
		}
		TwInvSkuLoctl twInvSkuLoctl = listTwInvSkuLoctl.get(0);
		// 可用数量-AVAILABLE_QTY
		twInvSkuLoctl.setAvailableQty(twInvSkuLoctl.getAvailableQty() - twDocOrderDetails.getSoReqQty());
		// 库存数量-CUR_QTY
		// twInvSkuLoctl.setrOubQty(twDocOrderDetails.getSoReqQty());
		// 待出库数量-R_OUB_QTY
		twInvSkuLoctl.setrOubQty(twDocOrderDetails.getSoReqQty());
		// 分配数量-R_ALLOC_QTY
		twInvSkuLoctl.setrAllocQty(twDocOrderDetails.getSoReqQty());
		// 出库订单分配数量-SO_R_ALLOC_QTY
		twInvSkuLoctl.setSorAllocQty(twDocOrderDetails.getSoReqQty());
		// 拣货数量-R_PICK_QTY
		twInvSkuLoctl.setrPickQty(0);
		// 出库订单拣货数量-SO_R_PICK_QTY
		twInvSkuLoctl.setSorPickQty(0);
		twInvSkuLoctlDao.updateNonEmptyTwInvSkuLoctlById(twInvSkuLoctl);
		// 【7】：生成 拣货任务表 明细 TW_OUTB_TASK_DETAIL
		BeanUtils.copyProperties(twDocOrderDetails, twOutbTaskDetail);
		twOutbTaskDetail.setTwOutbTaskHeaderId(twOutbTaskHeader.getTwOutbTaskHeaderId());
		twOutbTaskDetail.setSoLineno(1);
		// 待拣货仓储单元id
		twOutbTaskDetail.setPreTmBasStorageId(listTrBasPartStorage.get(0).getLocId());
		// 要求分配数量 <--要求发货数量(soReqQty)
		twOutbTaskDetail.setPreAllocQty(twDocOrderDetails.getSoReqQty());
		// 实际分配数量 <--要求发货数量(soReqQty)
		twOutbTaskDetail.setAllocQty(twDocOrderDetails.getSoReqQty());
		// 要求分配包装数
		twOutbTaskDetail.setPreAllocPackNum(twDocOrderDetails.getSoPackageNum());
		// 实际分配包装数量
		twOutbTaskDetail.setAllocPackNum(twDocOrderDetails.getSoPackageNum());
		// 要求分配包装代码
		twOutbTaskDetail.setPreAllocPack(twDocOrderDetails.getSoPackageNo());
		// 实际分配包装代码
		twOutbTaskDetail.setAllocPack(twDocOrderDetails.getSoPackageNo());
		// 分配类型（0出库订单分配1翻包补货分配2补货分配）
		twOutbTaskDetail.setAllocType("0");
		// 拣货任务标签打印状态（0打印 1已打印）
		twOutbTaskDetail.setPrintStatus("0");
		// 任务标签打印状态（0打印 1已打印）
		twOutbTaskDetail.setTaskPrintStatus("0");
		// 分配明细id
		twOutbTaskDetail.setTwActAllocLotdId(twActAllocLotd.getTwActAllocLotdId());
		// 拣货状态（新任务0，任务完成1，2部分拣货）
		twOutbTaskDetail.setPickStatus("0");
		twOutbTaskDetail.setLineno(1);
		// 拣货任务清单单号
		twOutbTaskDetail.setPickAllocNo(pickAllocNo);
		twOutbTaskDetail.setDestLocId(listTrBasPartStorage.get(0).getLocId());
		// 库内跟踪流水号码
		twOutbTaskDetail.setInbSerialNo(twInvSkuLoctl.getInbSerialNo());
		// 批次号
		twOutbTaskDetail.setLotNo(twInvSkuLoctl.getLotNo());
		// 零件包装流水号
		twOutbTaskDetail.setPartPackSerial(twInvSkuLoctl.getPartPackSerial());
		// 出库时间
		twOutbTaskDetail.setOutboundTime(twDocOrderDetails.getSoSendTime());
		// 出库人
		twOutbTaskDetail.setOutboundMan(SpringWebUtils.getRequestUser());
		twOutbTaskDetail.setMarkStatus(1);
		twOutbTaskDetail.setCreateTime(new Date());
		twOutbTaskDetail.setCreateUser(SpringWebUtils.getRequestUser());
		twOutbTaskDetail.setCompanyCode(SpringWebUtils.getRequestCompany());
		twOutbTaskDetailDao.insertNonEmptyTwOutbTaskDetail(twOutbTaskDetail);

		// 【8】：向分配表 TW_ACT_ALLOC_LOT_D 插入数据
		BeanUtils.copyProperties(twDocOrderDetails, twActAllocLotd);
		// 待拣货仓储单元ID
		twActAllocLotd.setPreTmBasStorageId(listTrBasPartStorage.get(0).getLocId());
		// 实际拣货仓储单元ID
		twActAllocLotd.setActTmBasStorageId(listTrBasPartStorage.get(0).getLocId());
		twActAllocLotd.setPartNoVersion(twDocOrderDetails.getPartNoVersion());
		twActAllocLotd.setLotNo(twInvSkuLoctl.getLotNo());
		// 分配类型（0出库订单分配1翻包补货分配2补货分配）
		twActAllocLotd.setAllocType("0");
		// 装箱标签打印状态（0打印1已打印）
		twActAllocLotd.setTaskPrintStatus("0");
		// 状态（新建0、拣货任务产生1、部分拣货2、拣货完成3、关闭4）
		twActAllocLotd.setItemPickStatus("1");
		twActAllocLotd.setTwOutbTaskDetailId(twOutbTaskDetail.getTwOutbTaskDetailId());
		// 装箱任务行号ID
		twActAllocLotd.setTwOutbTaskHeaderId(twOutbTaskHeader.getTwOutbTaskHeaderId());
		// 补货任务表头ID
		twActAllocLotd.setTwDocOrderHeaderId(twDocOrderDetails.getTwDocOrderHeaderId());
		// SO明细ID
		twActAllocLotd.setTwDocOrderDetailsId(twDocOrderDetails.getTwDocOrderDetailsId());
		// 状态（发运任务未产生0、发运任务产生1、部分发运2、发运完成3）
		twActAllocLotd.setItemLoadStatus("0");
		// 实际分配数量
		twActAllocLotd.setAllocQty(twDocOrderDetails.getSoReceivedQty());
		// 要求分配数量
		twActAllocLotd.setPreAllocQty(twDocOrderDetails.getSoReceivedQty());
		// 实际分配包装数量
		twActAllocLotd.setAllocPackNum(twDocOrderDetails.getSoPackageNum());
		// 要求分配包装数量
		twActAllocLotd.setPreAllocPackNum(twDocOrderDetails.getSoPackageNum());
		// 实际分配供应商编号
		twActAllocLotd.setActSupplNo(twDocOrderDetails.getSupplNo());
		// 实际分配包装容量
		twActAllocLotd.setAllocPackageQty(twDocOrderDetails.getSoPackageQty());
		// 要求分配包装容量
		twActAllocLotd.setPreAllocPackageQty(twDocOrderDetails.getSoPackageQty());
		twActAllocLotd.setMarkStatus(1);
		twActAllocLotd.setCreateTime(new Date());
		twActAllocLotd.setCreateUser(SpringWebUtils.getRequestUser());
		twActAllocLotd.setCompanyCode(SpringWebUtils.getRequestCompany());
		twActAllocLotdDao.insertNonEmptyTwActAllocLotd(twActAllocLotd);
		// 【9】：更新tw_doc_order_details的状态为分配完成
		// 订单行状态（新单0、部分分配1、分配完成2、部分拣货3、拣货完成4、订单取消9、关闭10、分配失败11）
		twDocOrderDetails.setLineStatus("2");
		// 实际分配数量 == 要求发货数量
		twDocOrderDetails.setAllocQty(twDocOrderDetails.getSoReqQty());
		// 实际分配包装代码 == 要求发货包装编号
		twDocOrderDetails.setAllocPack(twDocOrderDetails.getSoPackageNo());
		// 实际分配包装数 == 要求发货箱数
		twDocOrderDetails.setAllocPackNum(twDocOrderDetails.getSoPackageNum());
		twDocOrderDetailsDao.updateNonEmptyTwDocOrderDetailsById(twDocOrderDetails);

		// 【9】：根据头表的tw_doc_order_header_id和so_sheet_no 从TW_DOC_ORDER_DETAILS找出对应的出库单明细.
		List<TwDocOrderDetails> listTwDocOrderDetails = twDocOrderDetailsDao.selectTwDocOrderDetails(new Assist(
				Assist.andEq("tw_doc_order_details.tw_doc_order_header_id", twDocOrderDetails.getTwDocOrderHeaderId()),
				Assist.andEq("tw_doc_order_details.so_sheet_no", twDocOrderDetails.getSoSheetNo())));
		if (listTwDocOrderDetails.size() > 0) {
			boolean flag = true;
			for (TwDocOrderDetails twDocOrderDetail : listTwDocOrderDetails) {
				if (!twDocOrderDetail.getLineStatus().equals("2")) {
					flag = false;
				}
			}
			if (flag) {
				// 【10】：更新TW_DOC_ORDER_HEADER的状态-->分配完成
				TwDocOrderHeader twDocOrderHeader2 = new TwDocOrderHeader();
				twDocOrderHeader2.setTwDocOrderHeaderId(twDocOrderDetails.getTwDocOrderHeaderId());
				// SO单证状态（新单0、部分分配1、分配完成2、部分拣货3、拣货完成4、部分装箱5、装箱完成6、部分发运7、发运完成8、订单取消9、单证关闭10）
				twDocOrderHeader2.setSoSheetStatus("2");
				twDocOrderHeaderDao.updateNonEmptyTwDocOrderHeaderById(twDocOrderHeader2);
			}
		}

	}

	/**
	 * 按行生成拣货任务 可操作状态:部分分配1，分配完成2 操作后状态：不变
	 * 
	 * @param twDocOrderDetails
	 */
	@Override
	public void generatePickingByBill(TwDocOrderDetails enti) {
		TwDocOrderDetails twDocOrderDetails = twDocOrderDetailsDao
				.selectTwDocOrderDetailsById(enti.getTwDocOrderDetailsId());
		if (!(twDocOrderDetails.getLineStatus().equals("2") || twDocOrderDetails.getLineStatus().equals("1"))) {
			throw new ServiceException("部分分配1，分配完成2时才能新增detail");
		}
		// 按行生成拣货任务 未实现...........
	}

	/**
	 * 【按行取消分配】 可操作状态：新单0，部分分配1，分配完成2 操作后状态:新单0
	 * 
	 * @param twDocOrderDetails
	 */
	@Override
	public void cancelDistribution(TwDocOrderDetails enti) {
		TwDocOrderDetails twDocOrderDetails = twDocOrderDetailsDao
				.selectTwDocOrderDetailsById(enti.getTwDocOrderDetailsId());
		if (!(twDocOrderDetails.getLineStatus().equals("2") || twDocOrderDetails.getLineStatus().equals("1"))) {
			throw new ServiceException("部分分配1，分配完成2时才能新增detail");
		}
		enti.setLineStatus("9");
		twDocOrderDetailsDao.updateNonEmptyTwDocOrderDetailsById(enti);
		// 按行取消分配 未实现...........
	}

	@Override
	public long getTwDocOrderDetailsRowCount(Assist assist) {
		return twDocOrderDetailsDao.getTwDocOrderDetailsRowCount(assist);
	}

	@Override
	public List<TwDocOrderDetails> selectTwDocOrderDetails(Assist assist) {
		return twDocOrderDetailsDao.selectTwDocOrderDetails(assist);
	}

	@Override
	public TwDocOrderDetails selectTwDocOrderDetailsByObj(TwDocOrderDetails obj) {
		return twDocOrderDetailsDao.selectTwDocOrderDetailsByObj(obj);
	}

	@Override
	public TwDocOrderDetails selectTwDocOrderDetailsById(Integer id) {
		return twDocOrderDetailsDao.selectTwDocOrderDetailsById(id);
	}

	@Override
	public int insertTwDocOrderDetails(TwDocOrderDetails value) {
		return twDocOrderDetailsDao.insertTwDocOrderDetails(value);
	}

	@Override
	public int insertTwDocOrderDetailsByBatch(List<TwDocOrderDetails> value) {
		return twDocOrderDetailsDao.insertTwDocOrderDetailsByBatch(value);
	}

	@Override
	public int deleteTwDocOrderDetailsById(Integer id) {
		return twDocOrderDetailsDao.deleteTwDocOrderDetailsById(id);
	}

	@Override
	public int deleteTwDocOrderDetails(Assist assist) {
		return twDocOrderDetailsDao.deleteTwDocOrderDetails(assist);
	}

	@Override
	public int updateTwDocOrderDetailsById(TwDocOrderDetails enti) {
		return twDocOrderDetailsDao.updateTwDocOrderDetailsById(enti);
	}

	@Override
	public int updateTwDocOrderDetails(TwDocOrderDetails value, Assist assist) {
		return twDocOrderDetailsDao.updateTwDocOrderDetails(value, assist);
	}

	@Override
	public int updateNonEmptyTwDocOrderDetailsById(TwDocOrderDetails enti) {
		// 订单行状态（新单0、部分分配1、分配完成2、部分拣货3、拣货完成4、订单取消9、关闭10、分配失败11）
		enti.setLineStatus("10");
		return twDocOrderDetailsDao.updateNonEmptyTwDocOrderDetailsById(enti);
	}

	@Override
	public int updateNonEmptyTwDocOrderDetails(TwDocOrderDetails value, Assist assist) {
		return twDocOrderDetailsDao.updateNonEmptyTwDocOrderDetails(value, assist);
	}

	@Override
	public String executeProcGetCode() {
		return jdbcDao.executeProcGetCode("tw_outb_task_header", "efast");
	}

}